//
//  ILGLibViewController+Category.m
//  ILGDemo
//
//  Created by happy on 2020/1/12.
//  Copyright © 2020 Happy. All rights reserved.
//

#import "ILGLibViewController+Category.h"
#import <objc/runtime.h>

@implementation ILGLibViewController (Category)

+ (void)load {
//    NSLog(@"%s", __func__);
}

//+ (void)initialize {
//    NSLog(@"%s", __func__);
//}

- (CGFloat)countNum {
    NSNumber *number = objc_getAssociatedObject([self class], _cmd);
    return number.floatValue;
}

- (void)setCountNum:(CGFloat)countNum {
    objc_setAssociatedObject([self class], @selector(countNum), @(countNum), OBJC_ASSOCIATION_RETAIN);
}

- (NSString *)name {
    return objc_getAssociatedObject([self class], _cmd);
}

- (void)setName:(NSString *)name {
    objc_setAssociatedObject([self class], @selector(name), name, OBJC_ASSOCIATION_COPY_NONATOMIC);
}

- (NSString *)address {
    return objc_getAssociatedObject([self class], _cmd);
}

- (void)setAddress:(NSString *)address {
    objc_setAssociatedObject([self class], @selector(address), address, OBJC_ASSOCIATION_COPY_NONATOMIC);
}

#pragma mark - others

- (void)sayHello:(NSString *)name {
    NSLog(@"sayHello to %@", name);
}

@end
